Let the integration tests run on pull requests from forks - #62
Merged
Conversation
The job reads the Mongo port and database name from the `testing` environment, which GitHub withholds from fork pull requests. Both resolved to an empty string, so the action was asked to publish port `` and gave docker `-p :`, which it rejects before any test runs. Defaults now stand in when the environment is absent. They are the only values that can work, since MONGO_URI already hard-codes 27017 and space_testing_db.
Alex-GF
approved these changes
Jul 31, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The problem
The Integration Tests Run workflow fails before it runs a single test on every pull request opened from a fork, including the four I currently have open (#58, #59, #60, #61). It has never passed on a fork PR; every successful run in the history came from a branch inside the repository.
The failing step:
The job declares
environment: testingand reads its configuration from that environment:GitHub does not expose an environment's secrets or variables to a
pull_requestrun whose head is a fork. Both expressions therefore resolve to an empty string,supercharge/mongodb-github-actionbuilds-p :, and docker refuses it.secrets.CI_JWT_SECRETandsecrets.CI_JWT_SALTare empty on the same runs, so even past the Mongo step the generatedapi/.envwould be missing the valuesutils/jwt.tsrequires.The result is that no external contribution can show a green suite, and a maintainer cannot tell a fork PR that breaks the tests from one that does not.
The change
Fallbacks on the four expressions, so the job is self-sufficient when the environment is unavailable. Where the environment is available — every internal PR, unchanged — its values still win.
The two Mongo values are not a guess.
envkey_MONGO_URIis hard-coded one step above:so the container has to listen on 27017 and hold
space_testing_dbor the suite cannot connect at all — the variables cannot currently hold anything else without breaking the run, and the defaults simply write that down. A comment abovejobs:records this, so the next reader knows the values are load-bearing rather than incidental.JWT_SECRETis a signing key andJWT_SALTa pbkdf2 salt (jwt.ts:45) for tokens minted and verified inside the same run, so any non-empty pair works; both are only checked for presence. No real secret is introduced and none is needed, since nothing outside the run ever sees these tokens.Verification
This PR verifies itself: a
pull_requestrun uses the workflow from the PR's own head, so the check on this page is the fixed workflow executing on a fork PR. If it is green, the bug is fixed.Locally I reproduced the CI environment exactly — Mongo 7.0.16 on 27017, Redis 7 on 6379, and an
api/.envbyte-for-byte identical to what the fixedMake envfilestep produces with every fallback taken (i.e. the worst case, no environment at all) — and ran the real CI command,pnpm run test:701 tests, all passing, on
mainwith no source changes — which also confirms the fallback credentials are sufficient for the whole suite, not just for reaching it.Scope
One file, four expressions and a comment. No change to the test suite, to the source, or to any run that currently succeeds: when
vars/secretsare populated the expressions evaluate exactly as before.A maintainer may prefer to drop
environment: testingand the twovarsentirely, given that their only possible values are the ones now written as defaults. I have left the environment in place because that is a call about your CI configuration rather than a fix for the failure, and this PR is meant to be the smallest change that makes fork PRs runnable.